import { BrowserRouter, Routes, Route } from 'react-router-dom'
import { Layout } from './page/Layout'
import { HomeDashboard } from './page/HomeDashboard'
import { TaskLibrary } from './page/TaskLibrary'
import { TaskExecution } from './page/TaskExecution'
import { Settings } from './page/Settings'
import { ToastDemo } from './page/ToastDemo'
import ExecutionHistory from './page/ExecutionHistory'
import { TaskProvider } from './contexts/TaskContext'
import { TaskHistoryProvider } from './contexts/TaskHistoryContext'
import { TaskExecutionProvider } from './contexts/TaskExecutionContext'
import { ToastProvider } from './components/Toast'

function App() {
  return (
    <TaskProvider>
      <TaskHistoryProvider>
        <TaskExecutionProvider>
          <ToastProvider>
            <BrowserRouter>
              <Layout>
                <Routes>
                  <Route path="/home" element={<HomeDashboard />} />
                  <Route path="/library" element={<TaskLibrary />} />
                  <Route path="/execution" element={<TaskExecution />} />
                  <Route path="/history" element={<ExecutionHistory />} />
                  <Route path="/settings" element={<Settings />} />
                  <Route path="/toast-demo" element={<ToastDemo />} />
                </Routes>
              </Layout>
            </BrowserRouter>
          </ToastProvider>
        </TaskExecutionProvider>
      </TaskHistoryProvider>
    </TaskProvider>
  )
}

export default App
